package com.sinosoft.perfect.system._resource.dao;

import java.sql.SQLException;
import java.util.List;

import com.sinosoft.perfect.system._.po.TResourceSystem;
import com.sinosoft.perfect.system._.po.TResourceSystemImg;

public interface IResourceDAO {
	
	public Object selectTResourceMAXSortNum(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  增加系统资源
	 */
	public Object insertTResource(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  按条件查询系统资源
	 */
	public List<TResourceSystem> selectTResource(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  根据resourceId查询所有层级子资源，返回当前资源及子资源集合
	 */
	public List<TResourceSystem> selectTResourceAndChildren(String resourceId) throws SQLException;
	
	public List<TResourceSystem> selectTResourceAndParents(String resourceId) throws SQLException;
	
	/**
	 *  根据资源level和资源superResouceId，查询最大排序编码
	 */
	public Object selectTResourceSortNum(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  根据资源level和资源superResouceId，查询最小排序编码
	 */
	public Object selectTResourceSortNumMin(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  根据resourceName，查询同名资源
	 */
	public Object selectTResourceByName(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  根据resourceName，查询排序编码
	 */
	public Object selectTResourceSortNumByName(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  更新系统资源
	 */
	public int updateTResourceByPK(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  更新资源及其子资源的状态，返回更新资源的集合
	 */
	public List<TResourceSystem> selectTResourceAndChildren(TResourceSystem tresourcesystem) throws SQLException;
	public void updateTResourceAndChildrenStatus(TResourceSystem tresourcesystem) throws SQLException;
	
	/**
	 *  删除资源及子资源
	 */
	public int deleteTRoleResourcesByResourceId(String resourceId) throws SQLException;
	public int deleteTResourcesByResourceId(String resourceId) throws SQLException;


	public Object insertTResourceImg(TResourceSystemImg tresourceSystemImg) throws SQLException;
	public int updateTResourceImg(TResourceSystemImg tresourceSystemImg) throws SQLException;
	public int deleteTResourceImg(TResourceSystemImg tresourceSystemImg) throws SQLException;
	public List<TResourceSystemImg> selectTResourceImg(TResourceSystemImg tresourceSystemImg) throws SQLException;
}
